<?
   include('../config.php');
   session_start();
   if(!isset($_SESSION['username'])){
     header('Location:login.php');
   }
   $paging_url       = 'page'; //rewriteCate();  
   $current_page		= getValue('page','int','GET',1);
   $limit_page 		= 10;
   $total_pro        = countAticle();
   $limit 				= ($current_page - 1)*$limit_page . ',' . ($limit_page);
?>
<!DOCTYPE HTML>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8;" />
	<meta name="author" content="Ta Van Chinh" />
   <link rel="Shortcut Icon" href="/theme/images/icon.ico" type="image/x-icon" />
	<title>Hệ thống quản lý website</title>
   <?=$css?>
   <?=$js?>
    
</head>

<body>
    <div id="list_product">
        <form>
        <div class="table_pro">
        <table style="font-size: 14px;color: #1C3A70; border:1px solid #ccc">
        <tr>
            <th>STT</th>
            <th>Tiêu đề</th>
            <th>Ngày</th>
            <th>Sửa</th>
            <th>Xóa</th>
        </tr>
        <?
            $arr_art = getArticle(0,$limit);
            $count  = count($arr_art);
            $i=0;
            foreach($arr_art as $key=>$value){
                $art_content = decode_entities($value['art_content']);
                $art_content = removeHTML($value['art_content']); //cut_string(html_entity_decode($value['art_content'],ENT_COMPAT,'utf-8'),100);
                $art_content = cut_string($art_content,200);  
                $i++;?>
                <tr>
                    <td style="text-align: center;"><?=$i?></td>
                    <td><?=$value['art_title']?></td>
                    <td><?=date('d/m/Y', $value['art_date'])?></td>
                    <td><a href="edit.php?art_id=<?=base64_encode($value['art_id'])?>">Sửa</a></td>
                    <td><a onclick="delArticle('<?=base64_encode($value['pro_id'])?>')">Xóa</a></td>
                </tr>
            <?}
        ?>
        </form>
        </table>
         <ul class="list_pages clear-fix">
            <?=generatePageBar('',$current_page,$limit_page,$total_pro,$paging_url,'btn-page','btn-page btn-select','Trước','Sau','Trang đầu','Trang cuối',1,1,3,'','page')?>
         </ul>
        </div>
    </div>
</body>
<style>
    td,th{
        border: 1px solid #ccc;
    }
</style>

</html>